package com.carlwang.validate;

import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import com.carlwang.validate.checker.FiledChecker;

public class Validator {

	public void validate(Map<String, List<Object>> paramMap,
			Map<String, String> paramMap1) {
		Set<Entry<String, List<Object>>> entryMap = paramMap.entrySet();
		Iterator<Entry<String, List<Object>>> iter = entryMap.iterator();
		while (iter.hasNext()) {
			Entry<String, List<Object>> entry = iter.next();
			String className = entry.getKey();
			try {
				FiledChecker checker = (FiledChecker) Class.forName(className)
						.newInstance();
				for (Object filed : entry.getValue()) {
					checker.checkFiled(filed);
				}
			} catch (InstantiationException | IllegalAccessException
					| ClassNotFoundException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
	}
}
